package com.hotleproject.service.impl;

import com.hotleproject.mapper.HotleMapper;
import com.hotleproject.pojo.Hotle;
import com.hotleproject.service.HotleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class HotleServiceImpl implements HotleService {
    @Autowired
    private HotleMapper hotleMapper;
    @Override
    public List<Hotle> findAll() {
        return this.hotleMapper.selectAll();
    }

    @Override
    public int findHotlegetCount() {
        return this.hotleMapper.selectHotlegetCount();
    }

    @Override
    public List<Hotle> findHotleByHotleCity(String hotleCity, int pageNo, int pageSize) {
        return this.hotleMapper.selectHotleByHotleCity(hotleCity,pageNo,pageSize);
    }



    //
    @Override
    public int getCount() {
        return hotleMapper.getCount();
    }

    @Override
    public List<Hotle> pageList(int pageNo,int pageSize) {
        return this.hotleMapper.pageList(pageNo,pageSize);
    }

    @Override
    public void addHotle(String hotlename,String hotleCity,String hotlePhone,String hotleImg,String hotleDec) {
        this.hotleMapper.insertHotle(hotlename,hotleCity,hotlePhone,hotleImg,hotleDec);
    }

    @Override
    public void updateHotle(String hotlename,String hotleCity,String hotlePhone,String hotleImg,String hotleDec,String Beforehotlename) {
        this.hotleMapper.updateHotle(hotlename,hotleCity,hotlePhone,hotleImg,hotleDec,Beforehotlename);
    }

    @Override
    public void deleteHotle(String hotlename) {
        this.hotleMapper.deleteHotle(hotlename);
    }
}
